package algorithms.leecode;

import java.util.ArrayList;
import java.util.List;

public class Au77 {
    public static void main(String[] args) {
        new Au77().combine(1,1);
    }

    public List<List<Integer>> combine(int n, int k) {
        List<List<Integer>> res = new ArrayList<>();
        List<Integer> tmp = new ArrayList<>();
        www(res,1,tmp,n,k);

        return res;
    }

    public void www(List<List<Integer>> res,int curr,List<Integer> tmp,int n,int k) {
        if (tmp.size() == k) {
            res.add(tmp);
            return;
        }
        for (int i = curr; i <= n; i++) {
            List<Integer> list = new ArrayList<>();
            list.addAll(tmp);
            list.add(i);
            www(res,i+1,list,n,k);
        }
    }
}
